package com.jxin.oms.order.infrastructure.repository.inorder.persistence;

import com.jxin.oms.order.domain.inorder.repository.persistence.IInOrderRepository;
import com.jxin.oms.order.domain.inorder.repository.table.InOrderDetailDo;
import com.jxin.oms.order.infrastructure.repository.inorder.dao.InOrderDetailDoMapper;
import com.jxin.oms.order.infrastructure.repository.inorder.dao.InOrderDoMapper;
import com.jxin.oms.order.domain.inorder.repository.table.InOrderDo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 原始单持久层 实现
 * @author Jxin
 * @version 1.0
 * @since 2020/1/15 17:14
 */
@Repository
public class InOrderRepository implements IInOrderRepository {
    @Autowired
    private InOrderDoMapper inOrderDoMapper;
    @Autowired
    private InOrderDetailDoMapper inOrderDetailDoMapper;
    @Override
    public void insert(InOrderDo inOrderDo) {
        inOrderDoMapper.insertSelective(inOrderDo);
    }

    @Override
    public void insert(InOrderDo inOrderDo, List<InOrderDetailDo> inOrderDetailDoList) {
        insert(inOrderDo);
        inOrderDetailDoMapper.insertList(inOrderDetailDoList);
    }
}
